#include "mediaplayerfactoryimpl.h"

#include <kdclib.h>
#include "kdcmediaplayer.h"

MediaPlayerFactoryImpl::MediaPlayerFactoryImpl( QObject *aParent ) : QObject( aParent ), pMainInstance( NULL )
{
	pMainInstance = createInstance( true );
}

MediaPlayerFactoryImpl::~MediaPlayerFactoryImpl()
{
	deletePtr( pMainInstance );
}

KDCMediaPlayerInterface* MediaPlayerFactoryImpl::mainInstance() const
{
	return pMainInstance;
}

KDCMediaPlayerInterface* MediaPlayerFactoryImpl::createInstance( bool aGui )
{
	KDCMediaPlayer *instance = new KDCMediaPlayer;
	if ( aGui )
		instance->createGui();
	addInstance( instance );
	return instance;
}
